<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>MPU6050 gyro/accelerometer driver</title>
<link href="tabs.css" rel="stylesheet" type="text/css" />
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="alias.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="alias.js"></script>

<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
</script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { searchBox.OnSelectItem(0); });
</script>


<script type="text/javascript">
  jQuery(document).ready(function () {
    if(gref){ // Number all _img and _table classes
      gref();
    }
  });
</script>

</head>
<body>
<div id="top"><!-- do not remove this div! -->

<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  
  
  <td style="padding-left: 0.5em;">
   <div id="projectname">nRF51 General Code Examples
   
   </div>
   
  </td>
  
  
  
 </tr>
 </tbody>
</table>
</div>

<!-- Generated by Doxygen 1.7.5 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="modules.html"><span>Modules</span></a></li>
      <li><a href="annotated.html"><span>Data&#160;Structures</span></a></li>
      <li><a href="files.html"><span>Files</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
</div>
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
  initNavTree('group__nrf__drivers__mpu6050.html','');
</script>
<div id="doc-content">
<div class="header">
  <div class="summary">
<a href="#func-members">Functions</a>  </div>
  <div class="headertitle">
<div class="title">MPU6050 gyro/accelerometer driver</div>  </div>
<div class="ingroups"><a class="el" href="group__nrf__drivers.html">Drivers</a></div></div>
<div class="contents">

<p>MPU6050 gyro/accelerometer driver.  
<a href="#details">More...</a></p>
<table class="memberdecls">
<tr><td colspan="2"><h2><a name="func-members"></a>
Functions</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__nrf__drivers__mpu6050.html#ga69d0fa94f347b662e7312e313595773e">mpu6050_init</a> (uint8_t device_address)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__nrf__drivers__mpu6050.html#ga2435390ec63c2d17ab67c32a55ccc867">mpu6050_register_write</a> (uint8_t register_address, const uint8_t value)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Writes a MPU6050 register contents over TWI.  <a href="#ga2435390ec63c2d17ab67c32a55ccc867"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__nrf__drivers__mpu6050.html#ga2a262546c837f7d4841c95099eb93c87">mpu6050_register_read</a> (uint8_t register_address, uint8_t *destination, uint8_t number_of_bytes)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Function to read MPU6050 register contents over TWI. Reads one or more consecutive registers.  <a href="#ga2a262546c837f7d4841c95099eb93c87"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__nrf__drivers__mpu6050.html#ga3af875981ed613d4377fd457753f323d">mpu6050_verify_product_id</a> (void)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Reads and verifies MPU6050 product ID.  <a href="#ga3af875981ed613d4377fd457753f323d"></a><br/></td></tr>
</table>
<hr/><a name="details" id="details"></a><h2>Detailed Description</h2>
<p>MPU6050 gyro/accelerometer driver. </p>
<hr/><h2>Function Documentation</h2>
<a class="anchor" id="ga69d0fa94f347b662e7312e313595773e"></a><!-- doxytag: member="mpu6050.h::mpu6050_init" ref="ga69d0fa94f347b662e7312e313595773e" args="(uint8_t device_address)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">bool mpu6050_init </td>
          <td>(</td>
          <td class="paramtype">uint8_t&#160;</td>
          <td class="paramname"><em>device_address</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<p>Initializes MPU6050 and verifies it's on the bus.</p>
<dl><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramname">device_address</td><td>Device TWI address in bits [6:0]. </td></tr>
  </table>
  </dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd></dd></dl>
<dl><dt><b>Return values:</b></dt><dd>
  <table class="retval">
    <tr><td class="paramname">true</td><td>MPU6050 found on the bus and ready for operation. </td></tr>
    <tr><td class="paramname">false</td><td>MPU6050 not found on the bus or communication failure. </td></tr>
  </table>
  </dd>
</dl>

<p>Definition at line <a class="el" href="mpu6050_8c_source.html#l00027">27</a> of file <a class="el" href="mpu6050_8c_source.html">mpu6050.c</a>.</p>

</div>
</div>
<a class="anchor" id="ga2435390ec63c2d17ab67c32a55ccc867"></a><!-- doxytag: member="mpu6050.h::mpu6050_register_write" ref="ga2435390ec63c2d17ab67c32a55ccc867" args="(uint8_t register_address, const uint8_t value)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">bool mpu6050_register_write </td>
          <td>(</td>
          <td class="paramtype">uint8_t&#160;</td>
          <td class="paramname"><em>register_address</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const uint8_t&#160;</td>
          <td class="paramname"><em>value</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Writes a MPU6050 register contents over TWI. </p>
<dl><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">register_address</td><td>Register address to start writing to </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">value</td><td>Value to write to register </td></tr>
  </table>
  </dd>
</dl>
<dl><dt><b>Return values:</b></dt><dd>
  <table class="retval">
    <tr><td class="paramname">true</td><td>Register write succeeded </td></tr>
    <tr><td class="paramname">false</td><td>Register write failed </td></tr>
  </table>
  </dd>
</dl>

<p>Definition at line <a class="el" href="mpu6050_8c_source.html#l00064">64</a> of file <a class="el" href="mpu6050_8c_source.html">mpu6050.c</a>.</p>

</div>
</div>
<a class="anchor" id="ga2a262546c837f7d4841c95099eb93c87"></a><!-- doxytag: member="mpu6050.h::mpu6050_register_read" ref="ga2a262546c837f7d4841c95099eb93c87" args="(uint8_t register_address, uint8_t *destination, uint8_t number_of_bytes)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">bool mpu6050_register_read </td>
          <td>(</td>
          <td class="paramtype">uint8_t&#160;</td>
          <td class="paramname"><em>register_address</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint8_t *&#160;</td>
          <td class="paramname"><em>destination</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint8_t&#160;</td>
          <td class="paramname"><em>number_of_bytes</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Function to read MPU6050 register contents over TWI. Reads one or more consecutive registers. </p>
<dl><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">register_address</td><td>Register address to start reading from </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">number_of_bytes</td><td>Number of bytes to read </td></tr>
    <tr><td class="paramdir">[out]</td><td class="paramname">destination</td><td>Pointer to a data buffer where read data will be stored </td></tr>
  </table>
  </dd>
</dl>
<dl><dt><b>Return values:</b></dt><dd>
  <table class="retval">
    <tr><td class="paramname">true</td><td>Register read succeeded </td></tr>
    <tr><td class="paramname">false</td><td>Register read failed </td></tr>
  </table>
  </dd>
</dl>

<p>Definition at line <a class="el" href="mpu6050_8c_source.html#l00073">73</a> of file <a class="el" href="mpu6050_8c_source.html">mpu6050.c</a>.</p>

</div>
</div>
<a class="anchor" id="ga3af875981ed613d4377fd457753f323d"></a><!-- doxytag: member="mpu6050.h::mpu6050_verify_product_id" ref="ga3af875981ed613d4377fd457753f323d" args="(void)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">bool mpu6050_verify_product_id </td>
          <td>(</td>
          <td class="paramtype">void&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Reads and verifies MPU6050 product ID. </p>
<dl><dt><b>Return values:</b></dt><dd>
  <table class="retval">
    <tr><td class="paramname">true</td><td>Product ID is what was expected </td></tr>
    <tr><td class="paramname">false</td><td>Product ID was not what was expected </td></tr>
  </table>
  </dd>
</dl>

<p>Definition at line <a class="el" href="mpu6050_8c_source.html#l00043">43</a> of file <a class="el" href="mpu6050_8c_source.html">mpu6050.c</a>.</p>

</div>
</div>
</div>
</div>
  <div id="nav-path" class="navpath">
    <ul>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Data Structures</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&#160;</span>Enumerations</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark">&#160;</span>Enumerator</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(7)"><span class="SelectionMark">&#160;</span>Defines</a></div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>


    <li class="footer">
      Copyright &copy 2006-2011 <a href="http://www.nordicsemi.no" style="text-decoration:none">Nordic Semiconductor</a>.
      All Rights Reserved.
      <a href="disclaimer.html">Disclaimer</a>
    </li>
   </ul>
 </div>


</body>
</html>
